package com.yellowpage.client.service;

import java.util.List;
import java.util.Map;

import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;

import com.yellowpage.white.common.Constants;
import com.yellowpage.white.common.PageRender;
import com.yellowpage.white.dao.QueryAssistantSQL;
import com.yellowpage.white.service.BaseServiceImpl;

import com.yellowpage.client.data.NspUserPayAccount;
import com.yellowpage.client.dao.NspUserPayAccountDao;

public class NspUserPayAccountServiceImpl extends BaseServiceImpl implements NspUserPayAccountService {
	  private NspUserPayAccountDao nspUserPayAccountDao;
	
	  public void setNspUserPayAccountDao(NspUserPayAccountDao nspUserPayAccountDao) {
		  this.nspUserPayAccountDao = nspUserPayAccountDao;
	  }
	
	
	  /* Smooth generate Method */ 
	  public NspUserPayAccount getNspUserPayAccount(Long id){
	      return nspUserPayAccountDao.get(id);
	  }
	  
    public List<NspUserPayAccount> getAllNspUserPayAccount(){
        return nspUserPayAccountDao.getAll();
    }
    
    public List<Map> queryNspUserPayAccountByPage(Map queryMap, PageRender pageRender) {		
        
		QueryAssistantSQL sqlAssistant = baseDao.newQueryAssistantSQL(
				"SELECT a.MOBILENO , a.DISCOUNTSOURCE , a.DICOUNTDESC , a.EFFECTTIME , a.EFFECTSTATE , a.PAYSOURCE , a.PAY , a.CREATETIME , " +
				"a.PAYSTATE , a.SUBMITTER , a.SUBMITTIME , a.UPDATEUSER , a.UPDATETIME , a.ID , a.DESCRIPTION    FROM NSP_USER_PAY_ACCOUNT a WHERE 1=1 ")
				    			.addCondition(" and MOBILENO = :mobileNo ")
							    			.addCondition(" and DISCOUNTSOURCE = :discountSource ")
							    			.addCondition(" and DICOUNTDESC = :dicountDesc ")
							    			.addCondition(" and date_format(EFFECTTIME,'%Y-%m-%d') = :effectTime ")
							    			.addCondition(" and EFFECTSTATE = :effectState ")
							    			.addCondition(" and PAYSOURCE = :paySource ")
							    			.addCondition(" and PAY = :pay ")
							    			.addCondition(" and date_format(CREATETIME,'%Y-%m-%d') = :createTime ")
							    			.addCondition(" and PAYSTATE = :payState ")
							    			.addCondition(" and SUBMITTER = :submitter ")
							    			.addCondition(" and date_format(SUBMITTIME,'%Y-%m-%d') = :submitTime ")
							    			.addCondition(" and UPDATEUSER = :updateUser ")
							    			.addCondition(" and date_format(UPDATETIME,'%Y-%m-%d') = :updateTime ")
							    			.addCondition(" and ID = :id ")
							    			.addCondition(" and DESCRIPTION = :description ")
							    ; 		    
		    

		List<Map> resultList = sqlAssistant.queryByPage(
				baseDao.getConnection(), queryMap, pageRender);

		return resultList;
	}
    
    
    public void saveNspUserPayAccount(NspUserPayAccount nspUserPayAccount){
        nspUserPayAccountDao.save(nspUserPayAccount);
    }
    
	  public void updateNspUserPayAccount(NspUserPayAccount nspUserPayAccount){
	      nspUserPayAccountDao.update(nspUserPayAccount);
	  }
	  
	  public void delete(List deleteList){
	      nspUserPayAccountDao.remove(deleteList);
	  }
	  
	  
	 
	
}	